package com.example.httpdemo.pojo;

import com.example.common.valid.CustomRange;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.*;

/**
 * @author Aaron
 * @since 2021/9/6 19:15
 * <p>描述：</p>
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class Door extends BaseVO {

    @NotNull
    @Range(min = 70, max = 120, message = "门宽应在 70-120 cm之间")
    private Integer width;

    @NotNull
    @Min(value = 200, message = "门高应大于 200 cm")
    @Max(value = 250, message = "门高应小于 250 cm")
    private Integer height;

    @Min(value = 8, message = "门厚度要大于 8 cm")
    private Integer thickness;

    @AssertTrue(message = "必须含有锁")
    private boolean canLock;

    @NotBlank
    @Pattern(regexp = "美心|TATA门业|梦天|尚品本色|罗兰Roland", message = "仅支持这几种品牌：[美心|TATA门业|梦天|尚品本色|罗兰Roland]")
    private String brand;

    @NotEmpty
    @Size(min = 2, max = 8, message = "门神名字只能取 2-8 个汉字")
    private String doorGod;

    @Length(min = 2, max = 5, message = "门的名字只能取 2-5 个汉字")
    private String doorName;

    @CustomRange(min = "1", max = "999999999", message = "数字取值应在 0 ~ 999999999 之间")
    private Integer test;

}
